import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class RecruitSortMapper extends Mapper<LongWritable,Text, RecruitSortFlowbean,Text> {
    Text v=new Text();
    RecruitSortFlowbean k=new RecruitSortFlowbean();
    protected void map(LongWritable key, Text value,Mapper<LongWritable,Text, RecruitSortFlowbean,Text>.Context context)
            throws IOException, InterruptedException {
        //1.获取一行
        String line =value.toString();
        //2.切割
        String[] fields=line.split("\t");
        //3.封装
        String jd_sub_type=fields[1];//招聘岗位类型
        long require_nums=Long.parseLong(fields[5]);//所需人数
        long city=Long.parseLong(fields[3]);//所在城市

        k.setRequire_nums(require_nums);
        k.setCity(city);
        k.setJd_sub_type(jd_sub_type);

        v.set(jd_sub_type);
        //4.写出
        context.write(k,v);

    }
}
